(function () {
  var $form_field = $("#<%= @form_field_id -%>")
  $("#assignable_<%= @assignable_id %> a").attr("href", "#").off("click")
  $form_field.val("<%= @assignable_id %>")
  $form_field.attr("data-image-file-width", <%= @picture.image_file_width %>)
  $form_field.attr("data-image-file-height", <%= @picture.image_file_height %>)
  Alchemy.closeCurrentDialog(function() {
    var elementEditor = $form_field[0].closest("alchemy-element-editor")
    if (elementEditor) {
      elementEditor.setDirty()
    }
  })
})()
